package com.pdstudio.carrecom.ui.activity.owner;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.pdstudio.carrecom.R;
import com.pdstudio.carrecom.api.HttpExecuteJson;
import com.pdstudio.carrecom.api.HttpExecuteJson.httpReturnJson;
import com.pdstudio.carrecom.api.ServiceHelper;
import com.pdstudio.carrecom.bean.ResultInfo;
import com.pdstudio.carrecom.bean.WeatherInfo;
import com.pdstudio.carrecom.bean.WeatherList;
import com.pdstudio.carrecom.logger.Logger;
import com.pdstudio.carrecom.tools.StringUtils;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * 
 * 类: ActivityOwner <br>
 * 描述: 我是车主<br>
 * 作者: ws <br>
 * 时间: 2015-6-15 下午11:32:03
 */
public class ActivityOwner extends Activity implements OnClickListener {

	private static final String TAG = "ActivityOwner";

	private static final int MSG_WHAT_ABOUT = 1;

	private TextView txtTitle;
	private ImageView ivBack;

	private ResultInfo mResultInfo;

	private TextView mAboutInfo;

	private LinearLayout mLinearLayoutMessageCenter;
	private LinearLayout mLinearLayoutWyzc;// 我要租车
	private LinearLayout mLinearLayoutCzbd;// 车主宝典
	private LinearLayout mLinearLayoutBxxb;// 保险续保
	private LinearLayout mLinearLayoutRescue;// 保险续保

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_owner);

		initTitle();
		initView();
	}

	@Override
	protected void onResume() {
		super.onResume();

		// getAbountInfo();
	}

	private Handler mHandler = new Handler() {
		@Override
		public void handleMessage(Message msg) {
			super.handleMessage(msg);
			Logger.i(TAG, msg);
			switch (msg.what) {
			case MSG_WHAT_ABOUT:// 关于
				if (mResultInfo != null) {
					mAboutInfo.setText(mResultInfo.data.toString());
				}
				break;

			default:
				break;
			}
		}
	};

	/**
	 * 方法: initTitle <br>
	 * 描述: 初始化页面标题 <br>
	 * 作者: ws <br>
	 * 时间: 2015-5-24 下午5:46:11
	 */
	private void initTitle() {
		txtTitle = (TextView) findViewById(R.id.title_text_nav);

		txtTitle.setText("我是车主");

		ivBack = (ImageView) findViewById(R.id.title_back);
		ivBack.setOnClickListener(this);
	}

	private void initView() {
		mLinearLayoutMessageCenter = (LinearLayout) findViewById(R.id.owner_xxzx);
		mLinearLayoutBxxb = (LinearLayout) findViewById(R.id.owner_bxxb);
		mLinearLayoutRescue = (LinearLayout) findViewById(R.id.owner_wxjy);
		mLinearLayoutCzbd = (LinearLayout) findViewById(R.id.owner_czbd);
		mLinearLayoutWyzc = (LinearLayout) findViewById(R.id.owner_wyzc);

		mLinearLayoutMessageCenter.setOnClickListener(this);
		mLinearLayoutBxxb.setOnClickListener(this);
		mLinearLayoutRescue.setOnClickListener(this);
		mLinearLayoutCzbd.setOnClickListener(this);
		mLinearLayoutWyzc.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.title_back:
			finish();
			break;
		case R.id.owner_xxzx:// 消息中心
			Intent messageIntent = new Intent(this, ActivityMessage.class);
			startActivity(messageIntent);
			break;
		case R.id.owner_bxxb:// 保险续保
			Intent bxxbIntent = new Intent(this, ActivityBxxb.class);
			startActivity(bxxbIntent);
			break;
		case R.id.owner_wxjy:// 维修救援
			Intent rescueIntent = new Intent(this, ActivityRescue.class);
			startActivity(rescueIntent);
			break;
		case R.id.owner_czbd:// 车主宝典
			Intent czbdIntent = new Intent(this, ActivityCzbd.class);
			startActivity(czbdIntent);
			break;
		case R.id.owner_wyzc:// 我要租车
			Intent wyzcIntent = new Intent(this, ActivityWyzc.class);
			startActivity(wyzcIntent);
			break;
		}
	}
}
